﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;

using DQYT.HTDZ.ISinglewellEvaluationService;
using DQYT.HTDZ.Model;
using DQYT.HTDZ.BusinessService;

namespace DQYT.HTDZ.SinglewellEvaluationService
{
    /// <summary>
    /// 有功最大值平衡率评价项类，主要功能是根据接口传过来的数据，
    /// 算出有功最大值平衡率评价项的分数和得出相应的建议，保存在EvaluationModel返回。
    /// </summary>
    public class YGMAXPHLEvaluationService : IEvaluationService
    {
        public DataTable Gets(IEnumerable<KeyValuePair<string, string>> ps)
        {
            string wellid = ps.Where(p => p.Key.ToLower().Equals("wellid")).Select(p => p.Value).First();
            string jcrq = ps.Where(p => p.Key.ToLower().Equals("jcrq")).Select(p => p.Value).First();
            BDCjsjFunc fun = new BDCjsjFunc();
            DataTable YGGL_TB = fun.getSingleParaData(wellid, jcrq,"HYGGL");
            return YGGL_TB;
        }

        public double Calculator(DataTable evalData)
        {
            
            //return (double)evalData.Compute("Max(HYGGL)","true");
            return 56;
        }

        public EvaluationModel Evaluate(double evaValue)
        {
            EvaluationModel evaModel = new EvaluationModel();
            evaModel.CompareValue = evaValue;
            evaModel.EvaluationValue = evaValue;
            evaModel.EvaluationDesc = "建议将平衡块重量下降10%";
            return evaModel;
        }

        /// <summary>
        /// 评价名称
        /// </summary>
        public string EvaluationName
        {
            get
            {
                return "有功最大值平衡率";
            }
        }
    }
}
